#  (C) Copyright Gennadiy Rozental 2001-2005.
#  (C) Copyright Juergen Hunold 2006.
#  Use, modification, and distribution are subject to the
#  Boost Software License, Version 1.0. (See accompanying file
#  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
#  See http://www.boost.org/libs/test for the library home page.

# bring in the rules for testing
import testing ;
import os ;

# requirements
import ../../config/checks/config : requires ;

local HAS_UBSAN = "NO_UBSAN" ; # need to defined something
if [ os.environ UBSAN ]
{
    HAS_UBSAN = "HAS_UBSAN=" [ os.environ UBSAN ] ;
}

ECHO $(HAS_UBSAN:J) ;

# Project
project boost/test-examples
    :
    : requirements
      <toolset>clang:<cxxflags>-Wno-c99-extensions <define>$(HAS_UBSAN:J)
    ;

# Define aliases for the needed libs to get shorter names
alias prg_exec_monitor
    : # sources
        /boost//prg_exec_monitor
    ;

alias unit_test_framework
    : # sources
        /boost//unit_test_framework
    ;

# make aliases explicit so the libraries will only be built when requested
explicit unit_test_framework ;
explicit prg_exec_monitor ;

alias boost_test_examples
:
    [ run      exec_mon_example.cpp prg_exec_monitor ]
    [ run-fail prg_exec_example.cpp prg_exec_monitor ]

    [ run-fail test_case_template_example.cpp unit_test_framework/<link>static ]

    [ run-fail unit_test_example_01.cpp unit_test_framework ]
    [ run-fail unit_test_example_02.cpp unit_test_framework/<link>static ]
    [ run-fail unit_test_example_03.cpp unit_test_framework/<link>static ]
    [ run-fail unit_test_example_04.cpp unit_test_framework : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ]
    [ run-fail unit_test_example_05.cpp unit_test_framework : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ]
    [ run-fail unit_test_example_06.cpp unit_test_framework ]
    [ run      unit_test_example_07.cpp unit_test_framework : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ]  ]
    [ run      unit_test_example_08.cpp unit_test_framework ]
    [ run      unit_test_example_09_1.cpp
               unit_test_example_09_2.cpp unit_test_framework ]
    [ run-fail unit_test_example_10.cpp unit_test_framework/<link>static ]
    [ run-fail unit_test_example_11.cpp unit_test_framework/<link>static ]
    [ link     unit_test_example_12.cpp unit_test_framework/<link>static ]
    [ run      unit_test_example_13.cpp ]
    [ run-fail unit_test_example_15.cpp : : : [ requires cxx11_decltype cxx11_hdr_random cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_variadic_macros cxx11_trailing_result_types cxx11_template_aliases ] ]
    [ run      unit_test_example_16.cpp unit_test_framework ]

    [ run      named_param_example.cpp ]

    [ run      const_string_test.cpp ]

    [ run-fail external_main_example_1.cpp unit_test_framework ]
    [ run-fail external_main_example_2.cpp unit_test_framework ]
    [ run-fail external_main_example_3.cpp ]
    [ run-fail filtering_example.cpp unit_test_framework/<link>static : : : [ requires cxx11_variadic_macros cxx11_decltype cxx11_auto_declarations ] ]
;
